package 比较器;
//3.
public class TsetDemo {
    public static void main(String[] args) {
        Student student1=new Student("mazcas",11,89.5);
        Student student2=new Student("mazb",12,87);

        System.out.println("根据年龄比较");
        AgeCompararor ageCompararor=new AgeCompararor();//new一个年龄比较器
        if(ageCompararor.compare(student1,student2)>0){
            System.out.println("student1的年龄>student2的年龄");
        }else{
            System.out.println("student1的年龄<student2的年龄");
        }

        System.out.println("根据姓名比较");
        NameComparator nameComparator=new NameComparator();//new一个姓名比较器
        if(nameComparator.compare(student1,student2)>0){//按照字母的ascill码值比较 c>b
            System.out.println("student1的姓名>student2姓名");
        }else{
            System.out.println("student1的姓名>student2姓名");
        }
    }
}
//打印：
/*根据年龄比较
student1的年龄<student2的年龄
根据姓名比较
student1的姓名>student2姓名*/
